package com.carl.generate.util;

import java.io.Serializable;
import java.util.List;

import org.hibernate.Query;


/**
 * @author dahu
 * date:2011-4-5
 * @param <T>
 */
public interface BaseDao<T > {
	
	public <T> void save(Object obj);

	public Serializable save(Object obj, Boolean bool);

	public <T> void delete(Class<T> c, Serializable id);
	
	public <T> void delete(Object obj);

//	public abstract <T> void delete(Boolean coercedelet, String queryString);
	public <T> void deleteAll(List<T> list);
	public <T> void update(T t);

	public <T> T getObj(Class<T> c, Serializable id);

	public <T> T loadObj(Class<T> c, Serializable id);

	public <T> T getObj(String queryString);

	public <T> T getObje(String queryString, Object... objects);

	public <T> List <T> getObjes(String queryString, Object... objects);
	
	public <T> List <T> getObjes(String queryString);

	public <T> void saveOrUpdateObj(T obj);

	public <T> void saveOrUpdateObjs(List<T> objs);

	public void saveList(List<T> list);
	public void saveListBySpring(final List<T> list);
	public Query getHQL(String hql, Object...values);
	public List<T> sqlQuery(String sql,Class calzz);
	public List<T> sqlQuery(String sql);
	
	public Page sqlPageQuery(String sql,int startLimit,int pageSize);
	
	public Page queryPageList(Finder finder,int fisrtResult,int pageSize);
	
	public Page queryPageList(Finder finder,int fisrtResult,int pageSize,Object[] params);
	
	public int countQuerySqlResult(String sql);
}
